IF(TARGET perfschema)
SET(files
${CMAKE_CURRENT_SOURCE_DIR}/before_setup.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/version.sql
${CMAKE_CURRENT_SOURCE_DIR}/tables/sys_config.sql
${CMAKE_CURRENT_SOURCE_DIR}/tables/sys_config_data_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/triggers/sys_config_insert_set_user.sql
${CMAKE_CURRENT_SOURCE_DIR}/triggers/sys_config_update_set_user.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/extract_schema_from_file_name.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/extract_table_from_file_name.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/format_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/format_path_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/format_statement.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/format_time.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/list_add.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/list_drop.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_is_account_enabled.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_is_consumer_enabled.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_is_instrument_default_enabled.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_is_instrument_default_timed.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_is_thread_instrumented.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_thread_id.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_thread_account.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_thread_stack.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/ps_thread_trx_info.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/quote_identifier.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/sys_get_config.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/version_major.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/version_minor.sql
${CMAKE_CURRENT_SOURCE_DIR}/functions/version_patch.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/innodb_buffer_stats_by_schema.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/x_innodb_buffer_stats_by_schema.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/innodb_buffer_stats_by_table.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/x_innodb_buffer_stats_by_table.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/innodb_lock_waits.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/x_innodb_lock_waits.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_object_overview.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_auto_increment_columns.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/x_schema_flattened_keys.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/schema_redundant_indexes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/i_s/privileges_by_table_by_level.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/ps_check_lost_instrumentation_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/latest_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_latest_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/io_by_thread_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_io_by_thread_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/io_global_by_file_by_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_io_global_by_file_by_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/io_global_by_file_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_io_global_by_file_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/io_global_by_wait_by_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_io_global_by_wait_by_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/io_global_by_wait_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_io_global_by_wait_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/memory_by_user_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_memory_by_user_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/memory_by_host_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_memory_by_host_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/memory_by_thread_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_memory_by_thread_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/memory_global_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_memory_global_by_current_bytes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/memory_global_total.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_memory_global_total.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_index_statistics.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_schema_index_statistics.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_ps_schema_table_statistics_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_table_statistics.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_schema_table_statistics.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_table_statistics_with_buffer.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_schema_table_statistics_with_buffer.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_tables_with_full_table_scans.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_schema_tables_with_full_table_scans.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_unused_indexes.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/schema_table_lock_waits.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_schema_table_lock_waits.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statement_analysis.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statement_analysis.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statements_with_errors_or_warnings.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statements_with_errors_or_warnings.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statements_with_full_table_scans.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statements_with_full_table_scans.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_ps_digest_avg_latency_distribution.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_ps_digest_95th_percentile_by_avg_us.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statements_with_runtimes_in_95th_percentile.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statements_with_runtimes_in_95th_percentile.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statements_with_sorting.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statements_with_sorting.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/statements_with_temp_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_statements_with_temp_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_by_file_io_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_by_file_io_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_by_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_by_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_by_statement_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_by_statement_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_by_statement_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_by_statement_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_by_stages.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_by_stages.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/user_summary_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_user_summary_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_by_file_io_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_by_file_io_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_by_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_by_file_io.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_by_statement_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_by_statement_type.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_by_statement_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_by_statement_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_by_stages.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_by_stages.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/host_summary_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_host_summary_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/wait_classes_global_by_avg_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_wait_classes_global_by_avg_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/wait_classes_global_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_wait_classes_global_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/waits_by_user_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_waits_by_user_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/waits_by_host_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_waits_by_host_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/waits_global_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_waits_global_by_latency.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/metrics.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/processlist_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_processlist_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/sessions.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/x_sessions.sql
${CMAKE_CURRENT_SOURCE_DIR}/views/p_s/session_ssl_status.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/create_synonym_db.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/execute_prepared_stmt.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/diagnostics.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/optimizer_switch.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_statement_avg_latency_histogram.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_trace_statement_digest.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_trace_thread.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_disable_background_threads.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_disable_consumer.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_disable_instrument.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_disable_thread.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_enable_background_threads.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_enable_consumer.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_enable_instrument.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_enable_thread.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_reload_saved.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_reset_to_default_57_before.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_reset_to_default_57.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_reset_to_default_57_after.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_save.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_disabled.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_disabled_consumers.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_disabled_instruments.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_enabled.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_enabled_consumers.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_setup_show_enabled_instruments.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/ps_truncate_all_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/statement_performance_analyzer.sql
${CMAKE_CURRENT_SOURCE_DIR}/procedures/table_exists.sql
${CMAKE_CURRENT_SOURCE_DIR}/after_setup.sql
)
ELSE()
SET(files
  ${CMAKE_CURRENT_SOURCE_DIR}/before_setup.sql
  ${CMAKE_CURRENT_SOURCE_DIR}/tables/sys_config.sql
  ${CMAKE_CURRENT_SOURCE_DIR}/tables/sys_config_data_57.sql
  ${CMAKE_CURRENT_SOURCE_DIR}/triggers/sys_config_insert_set_user.sql
  ${CMAKE_CURRENT_SOURCE_DIR}/triggers/sys_config_update_set_user.sql   
  ${CMAKE_CURRENT_SOURCE_DIR}/after_setup.sql)
ENDIF()

SET_PROPERTY(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${files})
SET(CMAKE_CONFIGURABLE_FILE_CONTENT)

FOREACH(f ${files})
  FILE(READ ${f} content)
  SET(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${content}\n")
ENDFOREACH()
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/configurable_file_content.in ${CMAKE_BINARY_DIR}/scripts/mariadb_sys_schema.sql)
